package com.example.personalizededucationsystem.dto.response;

import com.example.personalizededucationsystem.model.ClassMember;
import lombok.Getter;
import lombok.Setter;

import java.time.Instant;

@Setter
@Getter
public class StudentMemberResponse {
    private Long userId;
    private String nickname;
    private String avatar;
    private Instant joinDate;

    // 静态工厂方法，方便从实体转换
    public static StudentMemberResponse fromEntity(ClassMember classMember) {
        StudentMemberResponse dto = new StudentMemberResponse();
        dto.setUserId(classMember.getStudent().getUserId());
        dto.setNickname(classMember.getStudent().getNickname());
        dto.setAvatar(classMember.getStudent().getAvatar());
        dto.setJoinDate(classMember.getJoinDate());
        return dto;
    }

}